# -*- coding:utf-8 -*-
"""
@author:shengwei
@file:ErrorDeal.py
@time:2018/2/12 001216:55
"""
from functools import reduce
import logging


def str2num(s):
    return int(s)


def calc(exp):
    ss = exp.split('+')
    ns = map(str2num, ss)
    return reduce(lambda acc, x: acc + x, ns)


def main():
    r = calc('100 + 200 + 345')
    print('100 + 200 + 345 =', r)
    r = calc('99 + 88 + 7.6')
    print('99 + 88 + 7.6 =', r)


try:
    main()
except Exception as e:
    logging.exception(e)
    # print('error----',e)
